import request from '@/utils/request'

export function roleList(data,flag) {
  return request({
    url: `/pc/role/page?flag=${flag.data}`,
    method: 'post',
    data
  })
}

export function roleAdd(data,flag) {
  return request({
    url: `pc/role/add?flag=${flag.data}`,
    method: 'post',
    data
  })
}

export function roleDetail(data,flag) {
  return request({
    url: `pc/role/detail?flag=${flag.data}`,
    method: 'get',
    params: data
  })
}

export function roleEdit(data,flag) {
  return request({
    url: `pc/role/update?flag=${flag.data}`,
    method: 'post',
    data
  })
}

export function delRole(data,flag) {
  return request({
    url: `pc/role/del?id=${data.id}&flag=${flag.data}`,
    method: 'get',
  })
}
// 获取字典

export function dicttype(data,flag) {
  return request({
    url: `pc/home/dict-type?type=${data.type}&flag=${flag.data}`,
    method: 'get',
  })
}


// 查询已分配的权限的菜单
export function getAllocation(data,flag) {
  return request({
    url: `pc/role/get-allocation?id=${data.id}&flag=${flag.data}`,
    method: 'get',
  })
}

// 分配菜单权限
export function allocation(data,flag) {
  return request({
    url: `pc/role/allocation?flag=${flag.data}`,
    method: 'post',
    data
  })
}


